console.log("12QuadTree");

let utils = data["utils"];
let RBushItem = data["RBushItem"];
let RBU = data["RBU"];
let RBush = data["RBush"];
let AreaForRender = data["AreaForRender"];
let quickselect = data["quickselect"];
let SphericalMercator = data["SphericalMercator"];
let PointItem = data["PointItem"];
let PointForRender = data["PointForRender"];
let BoundsItem = data["BoundsItem"];
let QuadTree = data["QuadTree"];
let Node = data["Node"];
let LeftNumFunnel = data["LeftNumFunnel"];

var boundsContain = BoundsItem.boundsContain, boundsIntersect = BoundsItem.boundsIntersect; utils.extend(Node.prototype, { getDN: function (noCache) { var count = this._dsdtNum; if (!noCache && count) return count; count = 0; var subNodes = this.getSubNodes(); if (subNodes.length) for (var i = 0, len = subNodes.length; i < len; i++)count += subNodes[i].getDN(noCache); else count = this.getChildren().length; return this._dsdtNum = count, count }, getBounds: function () { return this._bounds }, insert: function (item) { if (this.nodes.length) { var index = this._findIndex(item); this.nodes[index].insert(item) } else { this.children.push(item); var len = this.children.length; if (this._depth < this._maxDepth && len > this._maxChildren) { var i; for (this.subdivide(), i = 0; i < len; i++)this.insert(this.children[i]); this.children.length = 0 } } }, retrieve: function (item) { if (this.nodes.length) { var index = this._findIndex(item); return this.nodes[index].retrieve(item) } return this.children }, _findIndex: function (item) { var b = this._bounds, left = !(item.x > b.x + b.width / 2), top = !(item.y > b.y + b.height / 2), index = 0; return left ? top || (index = 2) : index = top ? 1 : 3, index }, findContainerNode: function (item) { var b = this._bounds, sureContain = !1; if (this.nodes.length) { var halfW = b.width / 2, halfH = b.height / 2, next = -1; if (boundsContain(b, item) && (sureContain = !0, boundsContain({ x: b.x, y: b.y, width: halfW, height: halfH }, item) ? next = 0 : boundsContain({ x: b.x + halfW, y: b.y, width: halfW, height: halfH }, item) ? next = 1 : boundsContain({ x: b.x, y: b.y + halfH, width: halfW, height: halfH }, item) ? next = 2 : boundsContain({ x: b.x + halfW, y: b.y + halfH, width: halfW, height: halfH }, item) && (next = 3)), next >= 0) return this.nodes[next].findContainerNode(item) } return sureContain || boundsIntersect(b, item) ? this : null }, subdivide: function () { var depth = this._depth + 1, bx = this._bounds.x, by = this._bounds.y, b_w_h = this._bounds.width / 2, b_h_h = this._bounds.height / 2, bx_b_w_h = bx + b_w_h, by_b_h_h = by + b_h_h; this.nodes[0] = new Node(new BoundsItem(bx, by, b_w_h, b_h_h), depth, this._maxDepth, this._maxChildren), this.nodes[1] = new Node(new BoundsItem(bx_b_w_h, by, b_w_h, b_h_h), depth, this._maxDepth, this._maxChildren), this.nodes[2] = new Node(new BoundsItem(bx, by_b_h_h, b_w_h, b_h_h), depth, this._maxDepth, this._maxChildren), this.nodes[3] = new Node(new BoundsItem(bx_b_w_h, by_b_h_h, b_w_h, b_h_h), depth, this._maxDepth, this._maxChildren) }, clear: function () { this.children.length = 0; var i, len = this.nodes.length; for (i = 0; i < len; i++)this.nodes[i].clear(); this.nodes.length = 0 } });



return {
  "utils": utils,
  "RBushItem": RBushItem,
  "RBU": RBU,
  "RBush": RBush,
  "AreaForRender": AreaForRender,
  "LeftNumFunnel": LeftNumFunnel,
  "quickselect": quickselect,
  "SphericalMercator": SphericalMercator,
  "PointItem": PointItem,
  "PointForRender": PointForRender,
  "BoundsItem": BoundsItem,
  "QuadTree": QuadTree,
  "Node": Node,
}